
<%
DIRECTIVE SAFE_OUTPUT_OPEN;
var headContent = {
include("/pages/template/head.html"){}
%>
<script type="text/javascript">
	var form = $("#agentForm");
	var addOper = {
		agentProsDiscountsave : function(id) {
			if (!validForm()) {
				return false;
			}

			var vasPidStr = "";
			var OperDiscount = "";
			var flag = true;
			$('input[name="checkedids"]:checked').each(function() {
				vasPidStr += $(this).val() + '-';
				OperDiscount = $("input[name='" + this.id + "']").val()
				if (OperDiscount == "") {
					flag = false;
					return;
				}
				vasPidStr += OperDiscount + "+";
			});
			if (vasPidStr == "") {
				BootstrapDialog.alert("请先配置折扣产品");
				return;
			}
			$("#myselectids").val(vasPidStr);

			if (!flag) {
					BootstrapDialog.alert("存在为空");
			} else {
				if (vasPidStr != "") {
					vasPidStr = vasPidStr.substring(0, vasPidStr.length - 1);
				}

				var url = 'system/agentProsDiscount/save/' + id;
				form1.action = url;
				form1.submit();
				return true;
			}
		},
		agentProsDiscountlist : function() {
			var form = $("#agentForm");
			var id = "1";
			var queryProductName = $("#queryProductName").val();
			var url = 'system/agentProsDiscount/add?queryProductName='
					+ queryProductName;
			form.action = url;
			form.submit();
		}
	};
</script>

<%
};
var bodyContent = {
%>
<form id="agentForm" name="form1" action="" method="post" class="form-horizontal" role="form">
	<table class="table">
		<% // 列表头部 %>
		<tr>
			<td>客户名称</td>
			<td>
				<select name="model.customerId" class="form-control" valid="vselect" validname="请选择客户">
					<option value="-1">请选择客户</option>
					${selectCustomer }
				</select>
			</td>
		</tr>
		</tr>
		<tr>
			<td>折扣开始日期</td>
			<td>
				<input class="form-control" type="text" name="model.begin_time" value="${model.begin_time}" valid="vtext" validname="折扣开始日期" />
			</td>
		</tr>
		</tr>
		<tr>
			<td>折扣结束日期</td>
			<td>
				<input class="form-control" type="text" name="model.end_time" value="${model.end_time}" valid="vtext" validname="折扣结束日期" />
			</td>
		</tr>
		<tr style="display: none">
			<td>平台产品名称</td>
			<td>
				<input class="form-control" id="myselectids" type="text" name="model.proId" value="${model.proId}" validname="平台产品名称" />
			</td>
		</tr>
	</table>




	<div class="tableSearch">
		<%  //查询列表 %>
		<div class="form-group" style="width: 50%; display: inline-block">
			<input class="form-control" type="text" id="queryProductName" name="productName" value="${productName!''}" placeholder="请输入产品名称" />
		</div>
		&nbsp;&nbsp;&nbsp;
		<button type="button" class="btn btn-default" onclick="resetForm();">
			<span class="glyphicon glyphicon-refresh"></span>
			重 置
		</button>
		<button type="button" class="btn btn-default" onclick="addOper.agentProsDiscountlist();" name="search">
			<span class="glyphicon glyphicon-search"></span>
			查 询
		</button>

	</div>


	<div style="height: 460px; overflow: scroll; overflow-x: hidden">
		<!-- 数据列表 -->
		<table class="table table-striped table-bordered table-hover">
			<thead>
				<tr>
					<th>序号</th>
					<%  // 列表头部 %>
					<th name="ids" style="width: 5%"></th>
					<th name="vasProdName" style="width: 45%">平台产品名称</th>
					<th name="productPrice">价格</th>
					<th name="discount">设置折扣</th>
				</tr>
			</thead>
			<tbody>
				<% for(item in page){ %>
				<tr>
					<td>${itemLP.index }</td>
					<td>
						<input type="checkbox" id="productvasids_${item.ids}" name="checkedids" value="${item.ids}" />
					</td>
					<%  // 列表内容 %>
					<td>${item.vasProdName}</td>
					<td>${item.productPrice}</td>
					<td>
						<input type="text" name="productvasids_${item.ids}" value="1" style="width: 100px;" class="form-control" />
					</td>
				</tr>
				<% } %>
			</tbody>
		</table>
	</div>


	<div style="height: 50px; clear: both;">&nbsp;</div>
	<nav class="navbar navbar-default navbar-fixed-bottom">
		<div class="container" style="padding: 5px 0px 5px 0px; text-align: center;">

			<button class="btn btn-default" onclick="closeIframe();return false;">关 闭</button>
			<button class="btn btn-primary" onclick="addOper.agentProsDiscountsave('${model.ids}');return false;">保 存</button>

		</div>
	</nav>
</form>
<%}; %>

<% layout("/pages/template/_layout.html",{head:headContent,body:bodyContent}){ %>
DIRECTIVE SAFE_OUTPUT_CLOSE;
<%} %>